home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / m / floor.man < prev    next >
Encoding:
Text File  |  1989-05-31  |  1.9 KB  |  67 lines

  1.  
  2.  
  3.  
  4. FLOOR            Mathematical Library Procedures            FLOOR
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      fabs, floor, ceil, rint - absolute value, floor, ceiling,
  10.      and round-to-nearest functions
  11.  
  12. SSYYNNOOPPSSIISS
  13.      ##iinncclluuddee <<mmaatthh..hh>>
  14.  
  15.      ddoouubbllee fflloooorr((xx))
  16.      ddoouubbllee xx;;
  17.  
  18.      ddoouubbllee cceeiill((xx))
  19.      ddoouubbllee xx;;
  20.  
  21.      ddoouubbllee ffaabbss((xx))
  22.      ddoouubbllee xx;;
  23.  
  24.      ddoouubbllee rriinntt((xx))
  25.      ddoouubbllee xx;;
  26.  
  27. DDEESSCCRRIIPPTTIIOONN
  28.      Fabs returns the absolute value |x|.
  29.  
  30.      Floor returns the largest integer no greater than x.
  31.  
  32.      Ceil returns the smallest integer no less than x.
  33.  
  34.      Rint returns the integer (represented as a double precision
  35.      number) nearest x in the direction of the prevailing round-
  36.      ing mode.
  37.  
  38. NNOOTTEESS
  39.      On a VAX, rint(x) is equivalent to adding half to the magni-
  40.      tude and then rounding towards zero.
  41.  
  42.      In the default rounding mode, to nearest, on a machine that
  43.      conforms to IEEE 754, rint(x) is the integer nearest x with
  44.      the additional stipulation that if |rint(x)-x|=1/2 then
  45.      rint(x) is even.  Other rounding modes can make rint act
  46.      like floor, or like ceil, or round towards zero.
  47.  
  48.      Another way to obtain an integer near x is to declare (in C)
  49.           double x;     int k;    k = x;
  50.      Most C compilers round x towards 0 to get the integer k, but
  51.      some do otherwise.  If in doubt, use floor, ceil, or rint
  52.      first, whichever you intend.  Also note that, if x is larger
  53.      than k can accommodate, the value of k and the presence or
  54.      absence of an integer overflow are hard to predict.
  55.  
  56. SSEEEE AALLSSOO
  57.      abs(3), ieee(3M), math(3M)
  58.  
  59.  
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 12, 1986                          1
  64.  
  65.  
  66.  
  67.